<template>
  <div>
    <el-container>
      <el-header class="main"
        ><h2>{{ $store.state.name }}.大型后台管理系统</h2>

       <el-button @click="exit" class="btn" type="danger" size="small"
            >退出</el-button
          >
          <span>用户名：{{ username }}</span>

       
      
      </el-header>
      <el-container>
        <el-aside width="220px">
          <v-nav></v-nav>
        </el-aside>
        <el-main>
          <!-- 二级路由出口 -->
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import vNav from "../components/vNav.vue";
export default {
  data() {
    return {
      username: "",
    };
  },
  mounted() {
    this.username = JSON.parse(sessionStorage.getItem("userinfo")).username;
    // this.changuser();
  },
  components: {
    vNav,
  },
  methods: {
    exit() {
      this.$store.dispatch("changeUser");
      this.$router.push("/login");
    },
  },
};
</script>

<style scoped>
.btn {
  position: fixed;
  left: 90%;
  top: 5%;

}
.main {
  text-align: center;
  line-height: 50%;
  background: #409eff;
}
span{
  float: left;
}

</style>
